package com.xposed.aliproxy.view;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Paint.FontMetrics;
import android.util.AttributeSet;
import android.view.View;

import com.xposed.aliproxy.qrcode.GlobalInstance;

public class FloatBall extends View {
    /* renamed from: a */
    public int f1870a = 150;
    /* renamed from: b */
    public int f1871b = 150;
    /* renamed from: c */
    public String f1872c = "";
    /* renamed from: d */
    public String f1873d = "";
    /* renamed from: e */
    private boolean f1874e;
    /* renamed from: f */
    private Paint f1875f;
    /* renamed from: g */
    private Paint f1876g;

    public FloatBall(Context context) {
        super(context);
        mo6129a();
    }

    public FloatBall(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
        mo6129a();
    }

    public FloatBall(Context context, AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
        mo6129a();
    }

    /* renamed from: a */
    public void mo6129a() {
        this.f1875f = new Paint();
        this.f1875f.setColor(Color.parseColor("#88888855"));
        this.f1875f.setAntiAlias(true);
        this.f1876g = new Paint();
        this.f1876g.setTextSize(30.0f);
        this.f1876g.setAntiAlias(true);
        this.f1876g.setFakeBoldText(true);
    }

    protected void onMeasure(int i, int i2) {
        setMeasuredDimension(this.f1870a, this.f1871b);
    }

    protected void onDraw(Canvas canvas) {
        if (!this.f1874e) {
            String str;
            canvas.drawCircle((float) (this.f1870a / 2), (float) (this.f1871b / 2), (float) (this.f1870a / 2), this.f1875f);
            if (GlobalInstance.getInstance().f1765d) {
                str = "在线";
                this.f1876g.setColor(-16711936);
            } else {
                str = "离线";
                this.f1876g.setColor(-65536);
            }
            float measureText = this.f1876g.measureText(str);
            FontMetrics fontMetrics = this.f1876g.getFontMetrics();
            canvas.drawText(str, ((float) (this.f1870a / 2)) - (measureText / 2.0f), ((float) (this.f1871b / 2)) + ((-(fontMetrics.descent + fontMetrics.ascent)) / 2.0f), this.f1876g);
        }
    }

    public void setDragState(boolean z) {
        this.f1874e = z;
        invalidate();
    }
}
